<?php
/***************************************************************************
 *   copyright : (C) 2009 Udrea Cristian
 *   site : http://code.google.com/p/testauction-php
 ***************************************************************************/

/***************************************************************************
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as 
 *   published by the Free Software Foundation; either version 2 of the
 *   License, or (at your option) any later version. Although none of the
 *   code may be sold. If you have been sold this script, get a refund.
 ***************************************************************************/
$buycredits_string = "";
if($session->logged_in){
	$buycredits_string .= "<button id=\"buycreditsbtn\" class=\"green-button\"
		onclick=\"window.location.href = 'main.php?page=25';\">Cumpara</button>";
}else{
	// OTHERWISE TELL THE USER TO LOG IN
	$buycredits_string .= "<button id=\"buycreditsbtn\" class=\"green-button\"
		onclick=\"showHideAlert('Trebuie sa te autentifici mai intai!', event);\">Cumpara</button>";
}
$template->setCurrentBlock("buy_credits");
$template->setVariable(BUYCREDITSORWLOGIN, $buycredits_string);
$template->parseCurrentBlock();

$auction_history_string = "";
foreach($lastClosed as $item) {
	$product_data = $auctionDB->getProductData($item['product_id']);
	$auction_history_string .= "<tr><td><a href=\"main.php?page=24&id=". $item['auction_id'] ."\">"
		.$product_data['product_name']." - ". ($auctionDB->getAuctionOfferCount($item['auction_id']) * 
		$item['offer_increment'] + $item['base_price']) ."</a></td></tr>";
}
$template->setCurrentBlock("auction_history");
$template->setVariable(AUCTIONHISTORY, $auction_history_string);
$template->parseCurrentBlock();

$template->show();
?>
